// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.core;

public class FastTrig {
    public static double cos(double radians) {
        return sin(radians + (Math.PI / 2));
    }

    public static double sin(double radians) {
        radians = reduceSinAngle(radians);
        return Math.abs(radians) <= Math.PI / 4 ? Math.sin(radians) : Math.cos((Math.PI / 2) - radians);
    }

    private static double reduceSinAngle(double _double) {
        _double %= Math.PI * 2;
        if (Math.abs(_double) > Math.PI) {
            _double -= Math.PI * 2;
        }

        if (Math.abs(_double) > Math.PI / 2) {
            _double = Math.PI - _double;
        }

        return _double;
    }
}
